#define _CRT_SECURE_NO_WARNINGS 1

#include "Sort.h"

void PrintArray(int* a, int n)
{
	for (int i = 0; i < n; i++)
	{
		printf("%d ", a[i]);
	}
	printf("\n");
}
void TestMergeSort()
{
	int a[] = {10,6,7,1,3,9,4,2};
	int sz = sizeof(a) / sizeof(a[0]);
	//MergeSort(a,sz);
	MergeSortNonR(a,sz);
	PrintArray(a,sz);
}
#define N 10000000
void TestOp()
{
	int* n1 = (int*)malloc(sizeof(int) * N);
	int* n2 = (int*)malloc(sizeof(int) * N);
	for (int i = 0; i < N; i++)
	{
		n1[i] = rand() + i;
		n2[i] = n1[i];
	}

	int begin1 = clock();
	MergeSort(n1, N);
	int end1 = clock();

	int begin2 = clock();
	MergeSortNonR(n2, N);
	int end2 = clock();

	printf("MergeSort: %d\n", end1 - begin1);
	printf("MergeSortNonR: %d\n", end2 - begin2);
	//PrintArray(n2,N);
}

void TestCountSort()
{
	int a[] = {2,4,6,7,9,1,2,3,5,2,7,8};
	int n = sizeof(a) / sizeof(a[0]);
	CountSort(a,n);
	PrintArray(a, n);
}

int main()
{
	//TestMergeSort();
	//TestOp();
	TestCountSort();
	return 0;
}